import 'package:flutter/material.dart';
import '../search.dart';

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        children: [
          ElevatedButton(
            onPressed: () {
              Navigator.of(context).push(
                MaterialPageRoute(builder: (context) => const SearchPage()),
              );
            },
            child: Text('基本路由跳转'),
          ),
          SizedBox(height: 20),
          ElevatedButton(
            onPressed: () {
              Navigator.pushNamed(context, "/news");
            },
            child: const Text("命名路由跳转"),
          ),
          const SizedBox(height: 20),
          ElevatedButton(
            onPressed: () {
              Navigator.pushNamed(
                context,
                "/form",
                arguments: {"title": "我是命名路由传值", "aid": 20},
              );
            },
            child: const Text("命名路由传值跳转"),
          ),
          ElevatedButton(
            onPressed: () {
              Navigator.pushNamed(context, "/dialog");
            },
            child: const Text("跳转dialog页面"),
          ),
          ElevatedButton(
            onPressed: () {
              Navigator.pushNamed(context, "/pageView");
            },
            child: const Text("跳转PageView页面"),
          ),
          ElevatedButton(
            onPressed: () {
              Navigator.pushNamed(context, "/pageViewBuilder");
            },
            child: const Text("跳转PageViewBuilder页面"),
          ),
          ElevatedButton(
            onPressed: () {
              Navigator.pushNamed(context, "/pageViewFullPage");
            },
            child: const Text("跳转PageView 无限加载"),
          ),
          ElevatedButton(
            onPressed: () {
              Navigator.pushNamed(context, "/pageViewSwiper");
            },
            child: const Text("跳转PageView 轮播图"),
          ),
          ElevatedButton(
            onPressed: () {
              Navigator.pushNamed(context, "/pageViewKeepAlive");
            },
            child: const Text("跳转pageView KeepAlive"),
          ),
        ],
      ),
    );
  }
}
